package com.baizhi.action;

import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class UserAction {
    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    //测试ajax工具函数请求

    public void login() throws IOException {
        HttpServletResponse response = ServletActionContext.getResponse();
        PrintWriter pw = response.getWriter();
        if("zhang3".equals(username)&&"123".equals(password)){
            pw.print("ok");
        }else{
            pw.print("error");
        }
        pw.flush();
    }

}
